package com.yy.jhl.ui.manager.presenter;

import com.google.gson.Gson;
import com.yy.common.commonutils.StringUtil;
import com.yy.jhl.api.Api;
import com.yy.jhl.api.RxSubscriber;
import com.yy.jhl.app.AppConstant;
import com.yy.jhl.bean.ProjectDetailInfo;
import com.yy.jhl.bean.ProjectInfo;
import com.yy.jhl.ui.manager.contract.MenuOneContract;
import com.yy.jhl.ui.manager.contract.ProjectDetailContract;

import java.util.HashMap;
import java.util.Map;

import okhttp3.ResponseBody;

/**
 * Created by Ellis.Li on 2017/8/30.
 */

public class ProjectDetailPresenter extends ProjectDetailContract.Presenter {
    @Override
    public void getProjectDetail(String id) {
        mRxManage.addSubscription(Api.getDefault().getProjectDetail(id), new RxSubscriber<ResponseBody>(mContext,true) {
            @Override
            protected void _onNext(String result) {
                ProjectDetailInfo projectInfo = new Gson().fromJson(result,ProjectDetailInfo.class);
                mView.getProjectDetail(projectInfo);
            }

            @Override
            protected void _onError(String message) {
                mView.getProjectDetailFail();
            }
        });
    }
}
